import React from 'react'
import { Switch, Route, Redirect } from 'react-router-dom'

import './App.css'

let Login = React.lazy(() => import("./containers/Login/Login"))
let Register = React.lazy(() => import("./containers/Register/Register"))
let Index = React.lazy(() => import("./containers/Index/Index.jsx"))
let Detail = React.lazy(() => import('./containers/Detail/Detail.jsx'))
let Order = React.lazy(() => import('./containers/Order/Order.jsx'))

export default function App() {
  return (
    <div className="max_app">
      <React.Suspense fallback={<div>加载中。。。。</div>}>
        <Switch>
          <Route exact path="/login" component={Login}></Route>
          <Route exact path="/register" component={Register}></Route>
          <Route exact path="/order" component={Order}></Route>
          <Route path="/index" component={Index}></Route>
          <Route exact path="/detail/:id" component={Detail}></Route>
          <Redirect to="/login"></Redirect>
        </Switch>
      </React.Suspense>
    </div>
  )
}
